﻿@{
    ViewBag.Title = "BatchForm";
    Layout = "~/Views/Shared/_FlowForm.cshtml";
}
@using LeSoft.Application.Code;
<script>
  
    var _BillType = request('BillType');    
    var _organizeId = request('OrganizeId') == "" ? "@OperatorProvider.Provider.Current().CompanyId" : request('OrganizeId');  
    var _TypeId = "", _TypeName = "";
    $(function () {
        initControl();
    });

    function initControl() {
        if (_BillType == "1") {
            _enCode = "OpenShopWorkType";
        }
        else if (_BillType == "2") {
            _enCode = "CloseShopWorkType";
        }
        else {
            _enCode = "";
        }
        //组织机构
        $("#Organize").ComboBoxTree({
            url: "../../BaseManage/Organize/GetTreeJsonById",
            description: "==请选择==",
            height: "200px",
            click: function (item) {
                _organizeId = item.id;             
            }
        });
        if (_organizeId != "") $("#Organize").ComboBoxSetValue(_organizeId);
        //类别
        $("#Type").ComboBoxTree({
            url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson",
            param: { EnCode: _enCode },
            description: "==请选择==",
            height: "200px",
            click: function (item) {
                _TypeId = item.id;
                _TypeName = item.text;
            }
        });
    }



    //保存表单
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls();
        postData["OrganizeId"] = _organizeId;
        postData["BillType"] = _BillType;
        postData["TypeId"] = _TypeId;
        postData["Type"] = _TypeName;
    
        $.SaveForm({
            url: "../../DailyEventManage/OpenShop/BatchSaveForm",
            param: { ShopStr: JSON.stringify(postData) },
            loading: "正在保存数据...",
            success: function () {           
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
            }
        })

    }
</script>

<div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
    <table class="form">
        <tr>
            <th class="formTitle">所属机构<font face="宋体">*</font></th>
            <td class="formValue">
                <div id="Organize" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
            </td>
        </tr>
        <tr>           
            <th class="formTitle">工作类型<font face="宋体">*</font></th>
            <td class="formValue">
                <div id="Type" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
            </td>
        </tr>
        <tr>
            <th class="formTitle">开始日期<font face="宋体">*</font></th>
            <td class="formValue">
                <input id="BeginDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">结束日期<font face="宋体">*</font></th>
            <td class="formValue">
                <input id="EndDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>
        @*<tr>
            <th class="formTitle">时间段<font face="宋体">*</font></th>
            <td class="formValue">
                <input id="BeginTime" style="height:28px;" type="text" class="input-wdatepicker" value="8:00:00" onfocus="WdatePicker({ dateFmt: 'H:mm:ss', maxDate: '#F{$dp.$D(\'EndTime\')}' })" isvalid="yes" checkexpession="NotNull" />至
                <input id="EndTime" style="height:28px;" type="text" class="input-wdatepicker" value="17:00:00" onfocus="WdatePicker({ dateFmt: 'H:mm:ss', minDate: '#F{$dp.$D(\'BeginTime\',{H:1})}' })" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>*@
        <tr>
            <th class="formTitle">附加说明</th>
            <td class="formValue" >
                <input id="Memo" type="text" class="form-control" />
            </td>
        </tr>
    </table>
</div>


